import Cookies from 'js-cookie'
import { UtilCookieInterface } from './types/util.cookies'

// js-cookie 访问存储cookie的组件
// App
// siderBar状态(开启/关闭)
export const SIDEBAR_STATUS = 'sidebar_status'
// USER
// 用户token
export const TOKEN_KEY = 'admin_access_token'

const cookies: UtilCookieInterface = {
  /**
   * @param name cookie name
   * @param value cookie value
   */
  set (name, value) {
    Cookies.set(name, value)
  },
  /**
   *
   * @param name 根据name拿到cookie值
   * @returns
   */
  get (name) {
    return Cookies.get(name)
  },
  /**
   *
   * @param name 根据name删除cookie
   * @returns
   */
  remove (name) {
    return Cookies.remove(name)
  }
}

export default cookies
